extends "../yanzhan-3/yanzhan-3.gd"


var baseId = ""
var upText1 = "皇家传奇获得的金币+2"
var upText2 = "炮击锁定距离最远的敌人"
func _extInit():
	._extInit()
	lv = 4             #等级的设置
	addSkill("击杀非召唤单位时，获得3金币，永久提高1点炮击(上限200)，并使该单位相邻的敌人<恐惧>2秒", "皇家传奇")
var p4 = 3
var num = 0
func _onKillChara(atkInfo):
	._onKillChara(atkInfo)	
	if atkInfo.hitCha.isSumm:return
	sys.main.player.plusGold(p4)
	if num < 200:
		attEx.atk += 1
		num += 1
		upAtt()
	var chas = getCellChas(atkInfo.hitCha.cell, 2, 1)
	for i in chas:
		castBuff(i, buff.b_twoSpd.new(-3, 2))

func upgrade():
	.upgrade()
	if upgraded == 1:
		p4 = 5

func setAiCha(cha):
	if upgraded == 2:
		aiCha = getFirstCha(1, "sortByDistanceDesc")
		$ui / Label.text = "%s|%s" % [name, aiCha.name]
	else:
		.setAiCha(cha)

func extendsEvo(cha):
	.extendsEvo(cha)
	if cha.get("num") != null:
		self.num = cha.num	

func toJson():
	var json = .toJson()
	json["num"] = num
	return json